Walkthrough: Implement shadow volumes using depth buffers in Direct3D 11
This walkthrough demonstrates how to render shadow volumes using depth maps, using Direct3D 11 on devices of all Direct3D feature levels.
Topic | Description |
---|---|
Learn how to create the Direct3D device resources necessary to support depth testing for shadow volumes. |
|
Render from the point of view of the light to create a two-dimensional depth map representing the shadow volume. |
|
Create a shadow effect by adding depth testing to your vertex (or geometry) shader and your pixel shader. |
|
Render higher-fidelity shadows on faster devices and faster shadows on less powerful devices. |
Shadow mapping application to Direct3D 9 desktop porting
Windows 8 adde d depth comparison functionality to feature level 9_1 and 9_3. Now you can migrate rendering code with shadow volumes to DirectX 11, and the Direct3D 11 renderer will be downlevel compatible with feature level 9 devices. This walkthrough shows how any Direct3D 11 app or game can implement traditional shadow volumes using depth testing. The code covers the following process:
- Creating Direct3D device resources for shadow mapping.
- Adding a rendering pass to create the depth map.
- Adding depth testing to the main rendering pass.
- Implementing the necessary shader code.
- Options for fast rendering on downlevel hardware.
Upon completing this walkthrough, you should be familiar with how to implement a basic compatible shadow volume technique in Direct3D 11 that's compatible with feature level 9_1 and above.
Prerequisites
You should Prepare your dev environment for Universal Windows Platform (UWP) DirectX game development. You don't need a template yet, but you'll need Microsoft Visual Studio 2015 to build the code sample for this walkthrough.
Related topics
Direct3D
Shadow mapping technical articles